package com.coding.kan_yi_dao.controller;


import com.coding.kan_yi_dao.common.Result;
import com.coding.kan_yi_dao.entity.GoodsHot;
import com.coding.kan_yi_dao.service.impl.GoodsHotServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author 砍一刀，不买就砍你一刀
 * @since 2023-09-20
 */
@Api(tags = "热销商品")
@RestController
@RequestMapping("/goods-hot")
@CrossOrigin
public class GoodsHotController {

    @Resource
    GoodsHotServiceImpl goodsHotService;

    //TODO 全查询
    @ApiOperation(value = "全查询")
    @GetMapping("/go_select/goodshot")
    public Result go_select() {
        return goodsHotService.go_select_all();
    }
    //TODO 添加
    @ApiOperation(value = "添加")
    @GetMapping("/go_insert/goodshot")
    public Result go_insert(GoodsHot goodsHot) {
        return goodsHotService.go_insert(goodsHot);
    }

    //TODO 修改
    @ApiOperation(value = "修改")
    @GetMapping("/go_update/goodshot")
    public Result go_update(GoodsHot goodsHot) {
        return Result.ok(goodsHotService.go_update(goodsHot));
    }

    //TODO 删除
    @ApiOperation(value = "删除操作")
    @GetMapping("/go_delete/goodshot")
    public Result go_delete(@RequestParam(value="ids",required=false) List<Integer> ids) {
        return goodsHotService.go_delete(ids);
    }

    //TODO 多表查询
    @ApiOperation(value = "多表查询")
    @GetMapping("/go_selectall/goodshot")
    public Result go_selectall(GoodsHot goodsHot){
        return goodsHotService.go_selectall(goodsHot);
    }

}
